<template>
  <div>
    <basic-container> 
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>内容运营</el-breadcrumb-item> 
        <el-breadcrumb-item>马甲评论</el-breadcrumb-item>
        <el-breadcrumb-item>添加</el-breadcrumb-item>
      </el-breadcrumb>
    </basic-container>
    <avue-form
      :option="option"
      v-model="obj" 
      @submit="submit"
      @error="error"
    >
    </avue-form>
  </div>
</template>

<script>
import { common } from "@/api/cat/httpRequest";
import { catUrl } from "@/config/env";
import { appCommentTemplate as baseURL } from "@/api/cat/baseUrls"; 
export default {
  data() {
    return {
      obj: {},
      option: {
        column: [
          {
            type: "textarea",
            label: "评论内容",
            span: 16,
            display: true,
            prop: "content",
            placeholder:'支持Excel表粘贴,一行一条评论内容',
          }
        ],
        labelPosition: "right",
        labelSuffix: "：",
        labelWidth: 150,
        menuBtn: true,
        submitBtn: true,
        submitText: "保存",
        emptyBtn: true,
        emptyText: "清空",
        menuPosition: "center",
      },
    };
  },
  methods: {
    async submit(form, done) {
      //处理数据,内容使用逗号拼接
      form.content = form.content.replace(/\r+|\n+/g,"'#'6'%'");
      let userInfo = this.$store.state.user.userInfo;
      form.update_admin_id = userInfo.id ? userInfo.id : null
      form.update_admin_name = userInfo.username
      let data = await common(baseURL.save,form, null, "POST");
      this.$router.go(-1);
      done();
    },
    error(err) {
      this.$message.success("请查看控制台");
      
    },
  },
};
</script>

<style>
</style>